package WordCount;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class WordCountMapper extends Mapper<LongWritable, Text,Text,LongWritable> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, LongWritable>.Context context) throws IOException, InterruptedException {
        String line =value.toString();
        String[] words =line.split(",");
        //每日登录次数
        //context.write(new Text(words[1]),new LongWritable(1));
        //用户登录次数
        context.write(new Text(words[0]),new LongWritable(1));
    }
}